#include "MessageCommand.h"
#include "CommandArgs.h"

#include "boost/any.hpp"

#include <windows.h>


MouseCommand::MouseCommand(const CommandArgs& args)
{
	m_Flags = boost::any_cast<unsigned>( args.getArg("flags") );
	m_PointX = boost::any_cast<int>( args.getArg("pointX") );
	m_PointY = boost::any_cast<int>( args.getArg("pointY") );
}

void MouseCommand::execute()
{
	mouse_event(m_Flags, m_PointX, m_PointY, 0, 0);
}

KbdCommand::KbdCommand(const CommandArgs& args)
{
	m_VirtualK = boost::any_cast<Byte>( args.getArg("virtualK") );
	m_ScanCode = boost::any_cast<Byte>( args.getArg("scanCode") );
	m_Flags = boost::any_cast<unsigned>( args.getArg("flags") );
}

void KbdCommand::execute()
{
	keybd_event(m_VirtualK, m_ScanCode, m_Flags, 0);
}